# Table 1: Key words across responses to each question version

# Clear all
rm(list=ls(all=TRUE))

# Import data
path <- "P:/2017-pathways/new/2-data"
setwd(path)
load("pathways-merged-intermediate.Rdata")

# Get rid of all variables except openanswer and treatment 
leandata <- data[,c(2,3,4)]

# List the 3 wordings/treatments
explabels <- c("Oil/gas", "Energy", "Transition")

# oil/gas (question)
table(grepl("olje",   leandata$r7km1a, ignore.case=TRUE)) # oil (word)
table(grepl("gass",   leandata$r7km1a, ignore.case=TRUE)) # gas (word)
table(grepl("energi", leandata$r7km1a, ignore.case=TRUE)) # energy (word)
table(grepl("omstil", leandata$r7km1a, ignore.case=TRUE)) # transition (word)

# energy (question)
table(grepl("olje",   leandata$r7km1b, ignore.case=TRUE)) # oil (word)
table(grepl("gass",   leandata$r7km1b, ignore.case=TRUE)) # gas (word)
table(grepl("energi", leandata$r7km1b, ignore.case=TRUE)) # energy (word)
table(grepl("omstil", leandata$r7km1b, ignore.case=TRUE)) # transition (word)


# transition (question)
table(grepl("olje",   leandata$r7km1c, ignore.case=TRUE)) # oil (word)
table(grepl("gass",   leandata$r7km1c, ignore.case=TRUE)) # gas (word)
table(grepl("energi", leandata$r7km1c, ignore.case=TRUE)) # energy (word)
table(grepl("omstil", leandata$r7km1c, ignore.case=TRUE)) # transition (word)

# total responses
length(leandata$r7km1a[leandata$r7km1a!=""]) # oil/gas (question)
length(leandata$r7km1b[leandata$r7km1b!=""]) # energy (question)
length(leandata$r7km1c[leandata$r7km1c!=""]) # transition (question)
